package cn.com.jinhao.hotline.commons.vo;

import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Pattern;

/**
 * hotline-spring-cloud
 * <p>Description: </p>
 *
 * @author ShaneMew
 * @version 1.0
 * @date 2020/4/8
 * @since 2020-04-08
 */
@Data
public class BaseRequestVO {
    public interface Create{}
    public interface Update{}

    @ApiModelProperty(value = "版本号")
    @NotNull(message = "缺少版本号", groups = {BaseRequestVO.Update.class})
    protected Integer version;

    /**
     * 创建人#ID
     */
    @ApiModelProperty(value = "创建人#ID")
    @NotBlank(message = "创建人#ID(creatorId)不能为空", groups = {BaseRequestVO.Create.class})
    @Pattern(regexp = "^[0-9]*$", message = "创建人#ID必须为数字")
    protected String creatorId;

    /**
     * 创建人
     */
    @ApiModelProperty(value = "创建人")
    @NotBlank(message = "创建人(creator)不能为空", groups = {BaseRequestVO.Create.class})
    protected String creator;

    /**
     * 创建时间
     */
    @ApiModelProperty(value = "创建时间")
    @NotNull(message = "缺少创建时间(createTime)", groups = {BaseRequestVO.Create.class})
    @Pattern(regexp = "((([0-9]{3}[1-9]|[0-9]{2}[1-9][0-9]|[0-9][1-9][0-9]{2}|[1-9][0-9]{3})-(((0[13578]|1[02])-(0[1-9]|[12][0-9]|3[01]))|((0[469]|11)-(0[1-9]|[12][0-9]|30))|(02-(0[1-9]|[1][0-9]|2[0-8]))))|((([0-9]{2})(0[48]|[2468][048]|[13579][26])|((0[48]|[2468][048]|[3579][26])00))-02-29))\\s([0-1][0-9]|2[0-3]):([0-5][0-9]):([0-5][0-9])$", message = "创建时间(createTime)日期格式不正确")
    protected String createTime;

    /**
     * 修改人#ID
     */
    @ApiModelProperty(value = "修改人#ID")
    @NotBlank(message = "修改人#ID(modifierId)不能为空", groups = {BaseRequestVO.Update.class})
    @Pattern(regexp = "^[0-9]*$", message = "修改人#ID(modifierId)必须为数字")
    protected String modifierId;

    /**
     * 修改人
     */
    @ApiModelProperty(value = "修改人")
    @NotBlank(message = "修改人(modifier)不能为空", groups = {BaseRequestVO.Update.class})
    protected String modifier;

    /**
     * 修改时间
     */
    @ApiModelProperty(value = "修改时间")
    @NotNull(message = "缺少修改时间(modifyTime)", groups = {BaseRequestVO.Update.class})
    @Pattern(regexp = "((([0-9]{3}[1-9]|[0-9]{2}[1-9][0-9]|[0-9][1-9][0-9]{2}|[1-9][0-9]{3})-(((0[13578]|1[02])-(0[1-9]|[12][0-9]|3[01]))|((0[469]|11)-(0[1-9]|[12][0-9]|30))|(02-(0[1-9]|[1][0-9]|2[0-8]))))|((([0-9]{2})(0[48]|[2468][048]|[13579][26])|((0[48]|[2468][048]|[3579][26])00))-02-29))\\s([0-1][0-9]|2[0-3]):([0-5][0-9]):([0-5][0-9])$", message = "修改时间日(modifyTime)期格式不正确")
    protected String modifyTime;
}
